package com.spotalog.shared.service.rest;

import static com.google.common.base.Strings.nullToEmpty;

public final class Endpoints {
	public static final class QueryParams {
		private QueryParams() {}

		public static final String KEYWORDS = "q";
		public static final String RADIUS = "r";
		public static final String LIMIT = "limit";
		public static final String CURSOR = "cursor";
		public static final String CREATED = "created";
		public static final String ALTERED = "altered";
	}

	public static final class Users {
		private Users() {}

		public static final String ENDPOINT = "user";
	}

	public static final class Photos {
		private Photos() {}

		public static final String ENDPOINT = "photo";
		public static final String UPLOAD = "upload";
		public static final String SERVE = "serve";
	}

	public static final class Spots {
		private Spots() {}

		public static final String ENDPOINT = "spot";

		public static final class QueryParams {
			private QueryParams() {}

			public static final String POPULAR = "popular";
			public static final String TYPE = "type";
		}
	}

	public static String path(String url, Object append) {
		String path = nullToEmpty(url);
		return String.format("%s%s%s", path, path.contains("/") ? "" : "/",
				append == null ? "" : append.toString());
	}

	private Endpoints() {}
}
